package org.kfive.nova.algorithm;

/**
 * Created with IntelliJ IDEA.
 * User: admin
 * Date: 14-5-25
 * Time: 下午4:11
 * To change this template use File | Settings | File Templates.
 */
public class LetterNumber {

    public static int letterNum(String letter){
        int seq=0;
        if(letter!=null&&!"".equals(letter)){
            char [] temp = letter.toLowerCase().toCharArray();
            int p = 1;
            for(int i=temp.length-1;i>=0;i--){
                char t = temp[i];
                seq += (t-'a'+1)*p;
                p *=26;
            }
        }
        return seq;
    }
}
